package com.lzs.kunei.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lzs.entity.Inventory;
import com.lzs.entity.Locator;
import com.lzs.kunei.mapper.InventoryMapper;
import com.lzs.kunei.service.InventoryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Locale;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wpy
 * @since 2020-11-24
 */
@Service
public class InventoryServiceImpl extends ServiceImpl<InventoryMapper, Inventory> implements InventoryService {
    @Autowired
    private InventoryMapper inventoryMapper;

    @Override
    public Long selectWarehouseid(String inventoryno) {
        QueryWrapper<Inventory> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("inventoryno",inventoryno);
        return inventoryMapper.selectList(queryWrapper).get(0).getWarehouseid();
    }

    @Override
    public IPage<Locator> selectInventoryPage(Map map, List<Long> list) {
        Integer current = (Integer) map.get("current");
        Integer size =(Integer) map.get("size");

        Page<Locator> page=new Page<>(current,size);
        return inventoryMapper.selectInventoryPage(page,map,list);
    }
}
